<div class="form">

<script type="text/javascript" language="javascript">
	$(document).ready(function() {
		$("#EduJrcollege_option_0").click(function() {
			if($(this).val() == 1){
				$('#percentage').show();
				$('#grade').hide();
			}
		});
		$("#EduJrcollege_option_1").click(function() {
			if($(this).val() == 2){
				$('#grade').show();
				$('#percentage').hide();
			}
		});
	});
</script>

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'edu-jrcollege-jr_college_form-form',
	'enableAjaxValidation'=>false,
	'enableClientValidation'=>true,
	'enableClientValidation'=>true,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>
	
	<?php $rangeYear = ApplicationConfig::app()->params['scaling_params']['yearOfPassing']; ?>

	<!-- <div class="row">
		<?php //echo $form->labelEx($model,'college_name'); ?>
		<?php //echo $form->textField($model,'college_name'); ?>
		<?php //echo $form->error($model,'college_name'); ?>
	</div> -->
	
	<input type="hidden" id="EduJrcollege_college_name_hidden" name="EduJrcollege_college_name_hidden" value="">
	
	<div class="row">
		<?php echo $form->label($model,'collegeID'); ?>
		
		<?php
							$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
		     			 		'name'=>'EduJrcollege[college_name]',
		      			 		'id'=>'EduJrcollege_college_name',
								'value'=>'',
		      					'source'=>'js: function(request, response) {
		   						 $.ajax({
		        					url: "'.$this->createUrl('/user_register/SecondRegister/GetCollegeName').'",
		        					dataType: "json",
		        					data: {
		            				term: request.term,
		            				state: $("#job_location_stateID_hidden").val(),           				
		        					},
		        					success: function (data) {
		                			response(data);
		        						}
		    						})
		 						}',
								//$this->createUrl('search/searchloc'),
		     			 		'options'=>array(
		                  		'showAnim'=>'fold',
								'minLength'=>'2',
		                  		'select'=> 'js:function(event, ui) {
		                  		$("#EduJrcollege_college_name").val(ui.item.value);
		                  		$("#EduJrcollege_college_name_hidden").val(ui.item.id);
		                  		
		                  		}'
								),
		                  		'htmlOptions'=>array('size'=>'40','class'=>'restaurant'),      
							 ));
						
							Yii::app()->clientScript->registerScript('custom_loc_search1','	
			    			$("#EduJrcollege_college_name").data( "autocomplete" )._renderItem = function( ul, item ) {
			    					return $( "<li></li>" ) .data( "item.autocomplete", item ) .append( "<a><h6>" + item.value + "</h6></a>" ) .appendTo(ul);
			 					
							};');
						?>
		
		
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'board'); ?>
		<?php echo $form->dropDownList($model,'board',ApplicationConfig::app()->params['scaling_params']['collegeBoard'], array('empty' => 'Select a Board')); ?>
		<?php echo $form->error($model,'board'); ?>
	</div>
	
	<div class="row" id="option">
		<?php echo $form->labelEx($model,'option'); ?>
		<?php echo $form->radioButtonList($model,'option', array('1' => 'percentage', '2' => 'grade')); ?>
		<?php echo $form->error($model,'option'); ?>
	</div>
	
	<div class="row" style="display:none" id="percentage">
		<?php echo $form->labelEx($model,'percentage'); ?>
		<?php echo $form->textField($model,'percentage'); ?>
		<B>%</B>
		<?php echo $form->error($model,'percentage'); ?>
	</div>
	
	<div class="row" style="display:none" id="grade">
		<?php echo $form->labelEx($model,'grade'); ?>
		<?php echo $form->textField($model,'grade'); ?>
		<?php echo $form->error($model,'grade'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'year_passing'); ?>
		<?php echo $form->dropDownList($model,'year_passing',ApplicationConfig::getYearValue($rangeYear['startYear'],$rangeYear['endYear']), array('empty' => 'Select a Year')); ?>
		<?php echo $form->error($model,'year_passing'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'specilization'); ?>
		<?php echo $form->textField($model,'specilization'); ?>
		<?php echo $form->error($model,'specilization'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'status'); ?>
		<?php echo $form->dropDownList($model,'status',ApplicationConfig::app()->params['vendor_params']['status'], array('empty' => 'Select Status')); ?>
		<?php echo $form->error($model,'status'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton('Submit'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->